{extend name="admin/b2c/base" /} {block name="resources"/}
<script src="ADMIN_JS/art_dialog.source.js"></script>
<script src="ADMIN_JS/iframe_tools.source.js"></script>
<script src="ADMIN_JS/material_managedialog.js"></script>
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/defau.css">
{/block} {block name="main"}
<div class="set-style">
	<dl>
		<dt>名称：</dt>
		<dd>
			<input id="link_title" type="text" />
		</dd>
	</dl>
	<dl>
		<dt>图片：</dt>
		<dd>
			<div class="class-logo">
				<p>
					<img id="imglink_pic">
				</p>
			</div>
			<div class="ncsc-upload-btn">
				<a href="javascript:void(0);"><span> <input
						hidefocus="true" size="1" class="input-file" name="file_upload"
						id="uploadImg" nc_type="change_store_label" type="file"
						onchange="imgUpload(this,'link_pic');"> <input type="hidden"
						id="link_pic" /></span>
					<p>
						<i class="fa fa-cloud-upload text"></i>上传图片
					</p> </a>
			</div>
			<p class="hint">
				<br> <span style="color: orange;">建议使用宽100像素-高100像素内的GIF或PNG透明图片；点击下方"提交"按钮后生效。</span>
			</p>
		</dd>
	</dl>
	<dl>
		<dt>链接地址:</dt>
		<dd>
			<p>
				<input id="link_url" type="text" />
			</p>
			<p class="hint">用于网站搜索引擎的优化，关键字之间请用英文逗号分隔</p>
		</dd>
	</dl>
	<dl>
		<dt>排序:</dt>
		<dd>
			<p>
				<input id="link_sort" type="text" />
			</p>
		</dd>
	</dl>
	<button class="edit_button" onclick="setConfigAjax();">提交</button>
</div>
<script src="ADMIN_JS/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
{include file="admin/b2c/openDialog" /}
<script>
	/**
	 *图片上传
	 */
	function imgUpload(event, obj) {
		var fileid = $(event).attr("id");
		fileCommonUpload("UPLOAD_URL", fileid, "__UPLOAD__", obj);
	}
	function setConfigAjax() {
		var link_title = $("#link_title").val();
		var link_url = $("#link_url").val();
		var link_pic = $("#link_pic").val();
		var link_sort = $("#link_sort").val();
		$.ajax({
			type : "post",
			url : "ADMIN_MAIN/Config/addLink",
			data : {
				'link_title' : link_title,
				'link_url' : link_url,
				'link_pic' : link_pic,
				'link_sort' : link_sort
			},
			success : function(data) {
				if (data["code"] > 0) {
					showMessage('success', data["message"],
							"ADMIN_MAIN/Config/linkList");
				} else {
					showMessage('error', data["message"]);
				}
			}
		});
	}
</script>
{/block}
